﻿<Window x:Class="UI.ApplicationSettings"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:control="clr-namespace:Q2Q.Controls"
	xmlns:local="clr-namespace:Q2Q.Controls.Converters"
    Title="Q2Cue Settings" Style="{StaticResource CustomWindowStyle}" Height="450" Width="300" MinHeight="420" MinWidth="500" WindowStyle="ToolWindow" ResizeMode="NoResize" WindowStartupLocation="CenterOwner">
	<Window.Resources>
		<LinearGradientBrush x:Key="Swoosh" EndPoint="1,0.5" StartPoint="0,0.5">
			<GradientStop Color="#FF555555" Offset="0"/>
			<GradientStop Color="White" Offset="1"/>
		</LinearGradientBrush>
		<Style TargetType="TextBlock">
			<Setter Property="Foreground" Value="{DynamicResource TextForeground2}" />
		</Style>
		<Style x:Key="SectionTitle" TargetType="TextBlock">
			<Setter Property="FontWeight" Value="SemiBold" />
			<Setter Property="Foreground" Value="{DynamicResource TextForeground2}" />
		</Style>
		<local:AudioDriverToVisibilityConverter x:Key="AudioDriverToVisibilityConverter"/>
		<Style TargetType="{x:Type Button}" BasedOn="{StaticResource CustomButton1}" />
	</Window.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
			<RowDefinition Height="Auto" />
		</Grid.RowDefinitions>
		<Grid Grid.Row="0" Height="60" Background="{DynamicResource PopupWindowAccent}">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<StackPanel Grid.Column="0" Margin="10" VerticalAlignment="Stretch" HorizontalAlignment="Left">
				<TextBlock FontSize="16" Text="Q2Cue Program Settings" HorizontalAlignment="Left" Foreground="White"  />
				<TextBlock FontSize="12" Text="Program Settings" HorizontalAlignment="Left" Foreground="White" />
			</StackPanel>
			<Image Grid.Column="1" Width="32" Height="32" Margin="0,0,30,0" HorizontalAlignment="Right" VerticalAlignment="Center" Source="/Q2Q;component/Images/32x32/Gears.png" />
		</Grid>
		<TabControl x:Name="Tabs" Grid.Row="1" Style="{DynamicResource TabControlStyle}" Background="{DynamicResource SettingsWindowBrush}">
			<TabItem Width="80">
				<TabItem.Header>
					<TextBlock TextWrapping="Wrap" Text="Program Settings" TextAlignment="Center"/>
				</TabItem.Header>
				<!--General Program Settings-->
				<StackPanel Margin="20, 10">
					<TextBlock Style="{StaticResource SectionTitle}" Text="Console" />
					<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
					<CheckBox x:Name="VerboseDebugging" Margin="4" Content="Verbose Debugging" />
					<!--<CheckBox x:Name="ShowConsole" Margin="4" Content="Show Console" />-->
					<TextBlock Style="{StaticResource SectionTitle}" Text="Remote Server" Margin="0,10,0,0" />
					<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
					<CheckBox x:Name="EnableRemoteServer" Margin="4" Content="Enable Remote Server" />
					<StackPanel Orientation="Horizontal" Margin="4,8,4,4">
						<TextBlock Text="Default Port:" Margin="0,0,4,0" />
						<TextBox x:Name="RemotePort" Width="80" />
					</StackPanel>
					<TextBlock Style="{StaticResource SectionTitle}" Text="Interface" Margin="0,10,0,0" />
					<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
					<StackPanel Orientation="Horizontal" Margin="4,8,4,4">
						<TextBlock Text="Font Size:" Margin="0,0,4,0" />
						<control:NumericalIncrementer x:Name="FontSizes" Margin="6,0,0,0" Width="40" DisallowTextEntry="True" MaxDecimals="0" MinValue="8" MaxValue="14" />
					</StackPanel>
				</StackPanel>


			</TabItem>
			<TabItem Width="80">
				<TabItem.Header>
					<TextBlock TextWrapping="Wrap" Text="Cue Defaults" TextAlignment="Center"/>
				</TabItem.Header>
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="1*" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="1*" />
					</Grid.ColumnDefinitions>
					<StackPanel >
						<StackPanel Margin="20, 10" Grid.Column="0">
							<TextBlock Style="{StaticResource SectionTitle}" Text="All Cues" />
							<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
							<StackPanel Margin="0,12">
								<TextBlock Grid.Column="0" Text="Default Transport-Action" VerticalAlignment="Center" HorizontalAlignment="Center"/>
								<ComboBox x:Name="DefaultAfterAction" Margin="0,6,0,0" Width="140">
									<ComboBoxItem Content="Nothing" />
									<ComboBoxItem Content="Delayed Advance" />
									<ComboBoxItem Content="Immediate Advance" />
									<ComboBoxItem Content="Advance on End" />
								</ComboBox>
							</StackPanel>
							<Grid Margin="0,4">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="Default Action Delay:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
								<control:NumericalIncrementer MinWidth="40" Grid.Column="1" x:Name="Delay" Margin="6,0,0,0" MinValue="0.5"/>
							</Grid>
						</StackPanel>
						<StackPanel Margin="20, 10" Grid.Column="0">
							<TextBlock Style="{StaticResource SectionTitle}" Text="Audio Cues" />
							<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
							<Grid Margin="0,4">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="Default Fade In:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
								<control:NumericalIncrementer MinWidth="40" Grid.Column="1" x:Name="FadeIn" Margin="6,0,0,0" />
							</Grid>
							<Grid Margin="0,4">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="Default Fade Out:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
								<control:NumericalIncrementer MinWidth="40" Grid.Column="1" x:Name="FadeOut" Margin="6,0,0,0" />
							</Grid>
							<Grid Margin="0,4">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="*" />
									<ColumnDefinition Width="Auto" />
								</Grid.ColumnDefinitions>
								<TextBlock Grid.Column="0" Text="Default Volume:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
								<control:NumericalIncrementer MinWidth="40" Grid.Column="1" x:Name="Volume" MaxValue="1" IncrementAmount="0.1" Margin="6,0,0,0" />
							</Grid>
							<!--<StackPanel Margin="0,12">
								<TextBlock Grid.Column="0" Text="Default Transport-Action" VerticalAlignment="Center" HorizontalAlignment="Center"/>
								<ComboBox x:Name="DefaultAfterAction" Margin="0,6,0,0" Width="140">
									<ComboBoxItem Content="Nothing" />
									<ComboBoxItem Content="Delayed Advance" />
									<ComboBoxItem Content="Immediate Advance" />
									<ComboBoxItem Content="Advance on End" />
								</ComboBox>
							</StackPanel>-->
						</StackPanel>
					</StackPanel>

					<Rectangle Grid.Column="1" Height="Auto" Width="1" >
						<Rectangle.Fill>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientStop Color="Black" Offset="0.49"/>
								<GradientStop Color="White" Offset="1"/>
								<GradientStop Color="White"/>
							</LinearGradientBrush>
						</Rectangle.Fill>
					</Rectangle>
					<StackPanel Grid.Column="2" Margin="20,10">
						<TextBlock Style="{StaticResource SectionTitle}" Text="Transport Cues" />
						<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />

						<StackPanel Margin="0,8">
							<TextBlock Grid.Column="0" Text="Default Cue Action" VerticalAlignment="Center" HorizontalAlignment="Center"/>
							<ComboBox x:Name="DefaultTransportAction" Margin="0,6,0,0" Width="140">
								<ComboBoxItem Content="Stop Specific Cue" />
								<ComboBoxItem Content="Stop All Cues" />
								<ComboBoxItem Content="Start Cue" />
								<ComboBoxItem Content="Bump Cue Status" />
							</ComboBox>
						</StackPanel>
						<StackPanel Margin="0,8">
							<StackPanel Orientation="Vertical" Margin="0,14,0,0">
								<TextBlock Style="{StaticResource SectionTitle}" Text="Stack Cues" />
								<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />

								<!--<StackPanel Margin="0,8">
									<TextBlock Grid.Column="0" Text="Default Transport-Action" VerticalAlignment="Center" HorizontalAlignment="Center"/>
									<ComboBox x:Name="DefaultStackTransportAction" Margin="0,6,0,0" Width="140">
										<ComboBoxItem Content="Nothing" />
										<ComboBoxItem Content="Delayed Advance" />
										<ComboBoxItem Content="Immediate Advance" />
									</ComboBox>
								</StackPanel>-->
								<Grid Margin="0,4">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="*" />
										<ColumnDefinition Width="Auto" />
									</Grid.ColumnDefinitions>
									<TextBlock Grid.Column="0" Text="Default AutoPan Duration:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
									<control:NumericalIncrementer MinWidth="40" MinValue="0.1" Grid.Column="1" x:Name="AutoPanDuration" IncrementAmount="1" Margin="6,0,0,0" />
								</Grid>
								<Grid Margin="0,4">
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="*" />
										<ColumnDefinition Width="Auto" />
									</Grid.ColumnDefinitions>
									<TextBlock Grid.Column="0" Text="Default AutoFade Duration:" VerticalAlignment="Center" HorizontalAlignment="Right"/>
									<control:NumericalIncrementer MinWidth="40" MinValue="0.1" Grid.Column="1" x:Name="AutoFadeDuration" IncrementAmount="1" Margin="6,0,0,0" />
								</Grid>
							</StackPanel>
						</StackPanel>
					</StackPanel>
				</Grid>
			</TabItem>
			<TabItem Width="80">
				<TabItem.Header>
					<TextBlock TextWrapping="Wrap" Text="Audio Settings" TextAlignment="Center"/>
				</TabItem.Header>
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="1*" />
						<ColumnDefinition Width="Auto" />
						<ColumnDefinition Width="1*" />
					</Grid.ColumnDefinitions>
					<StackPanel Margin="20, 10" Grid.Column="0">
						<TextBlock Style="{StaticResource SectionTitle}" Text="Audio Device" />
						<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />
						<StackPanel Margin="0,12">
							<TextBlock Text="Select Audio Device" VerticalAlignment="Center" HorizontalAlignment="Center"/>
							<ComboBox x:Name="AudioDeviceSelection" SelectedIndex="1" Width="120" Margin="0,6,0,0">
								<ComboBoxItem Content="Wave Player" />
								<ComboBoxItem Content="WASAPI Player" />
								<!--<ComboBoxItem Content="ASIO Player" />-->
							</ComboBox>
						</StackPanel>
					</StackPanel>

					<Rectangle Grid.Column="1" Height="Auto" Width="1" >
						<Rectangle.Fill>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
								<GradientStop Color="Black" Offset="0.49"/>
								<GradientStop Color="White" Offset="1"/>
								<GradientStop Color="White"/>
							</LinearGradientBrush>
						</Rectangle.Fill>
					</Rectangle>

					<StackPanel Margin="20, 10" Grid.Column="2">
						<TextBlock Style="{StaticResource SectionTitle}" Text="Device Settings" />
						<Border Height="1" Width="Auto" HorizontalAlignment="Stretch" Margin="0,2,0,0" Background="{StaticResource Swoosh}" />

						<!--<StackPanel Margin="0,12" Visibility="{Binding SelectedItem, ConverterParameter=0, Converter={StaticResource AudioDriverToVisibilityConverter}, ElementName=AudioDeviceSelection}">
							<TextBlock Text="This audio device has no settings." />
						</StackPanel>-->
						<StackPanel Margin="0,12" Orientation="Horizontal" Visibility="{Binding SelectedItem, ConverterParameter=3, Converter={StaticResource AudioDriverToVisibilityConverter}, ElementName=AudioDeviceSelection}">
							<TextBlock Text="Player Latency (in ms)" />
							<control:NumericalIncrementer x:Name="Latency" MaxDecimals="0" MaxValue="350" MinValue="20" Margin="10,0,0,0" Width="60" />
						</StackPanel>
						<StackPanel Margin="0,12" Visibility="{Binding SelectedItem, ConverterParameter=1, Converter={StaticResource AudioDriverToVisibilityConverter}, ElementName=AudioDeviceSelection}">
							<TextBlock Text="MultiChannel Settings" />
							<StackPanel Margin="0,6" Orientation="Horizontal">
								<UniformGrid Columns="1" Rows="3">
									<Border BorderBrush="Black" BorderThickness="2,2,1,1">
										<TextBlock Margin="6,4" Text="Channel #" HorizontalAlignment="Right" Grid.Row="0" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="2,1,1,1">
										<TextBlock Margin="6,4" Text="Enable" HorizontalAlignment="Right" Grid.Row="1" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="2,1,1,2">
										<TextBlock Margin="6,4" Text="Default" HorizontalAlignment="Right" Grid.Row="2" />
									</Border>
								</UniformGrid>
								<UniformGrid Columns="4" Rows="3">
									<Border BorderBrush="Black" BorderThickness="1,2,1,1">
										<TextBlock Text="0,1" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,2,1,1">
										<TextBlock Text="2,3" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,2,1,1">
										<TextBlock Text="4,5" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,2,2,1">
										<TextBlock Text="6,7" HorizontalAlignment="Center" Margin="6,4" />
									</Border>


									<Border BorderBrush="Black" BorderThickness="1">
										<CheckBox x:Name="ce_01" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1">
										<CheckBox x:Name="ce_23" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1">
										<CheckBox x:Name="ce_45" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,1,2,1">
										<CheckBox x:Name="ce_67" HorizontalAlignment="Center" Margin="6,4" />
									</Border>

									<Border BorderBrush="Black" BorderThickness="1,1,1,2">
										<CheckBox x:Name="cd_01" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,1,1,2">
										<CheckBox x:Name="cd_23" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,1,1,2">
										<CheckBox x:Name="cd_45" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
									<Border BorderBrush="Black" BorderThickness="1,1,2,2">
										<CheckBox x:Name="cd_67" HorizontalAlignment="Center" Margin="6,4" />
									</Border>
								</UniformGrid>
							</StackPanel>
							<!--<StackPanel Margin="0,12" Visibility="{Binding SelectedItem, ConverterParameter=1, Converter={StaticResource AudioDriverToVisibilityConverter}, ElementName=AudioDeviceSelection}">
									<TextBlock Text="Select Playback Device"/>
									<ComboBox x:Name="WASAPIDeviceSelection" Margin="0,6" />
								</StackPanel>-->
						</StackPanel>

						<StackPanel Margin="0,12" Visibility="{Binding SelectedItem, ConverterParameter=2, Converter={StaticResource AudioDriverToVisibilityConverter}, ElementName=AudioDeviceSelection}">
							<TextBlock Text="Select ASIO Driver"/>
							<ComboBox x:Name="ASIODriverSelection" Margin="0,6" />
						</StackPanel>

					</StackPanel>

				</Grid>
			</TabItem>
			<TabItem Width="80">
				<TabItem.Header>
					<TextBlock TextWrapping="Wrap" Text="Theme" TextAlignment="Center" />
				</TabItem.Header>
				<Grid>
					<!--<Grid.ColumnDefinitions>
						<ColumnDefinition Width="1*" />
						<ColumnDefinition Width="1*" />
					</Grid.ColumnDefinitions>-->

					<StackPanel Grid.Column="0" HorizontalAlignment="Center" Margin="20,10" >
						<TextBlock Style="{StaticResource SectionTitle}" Text="Theme" HorizontalAlignment="Center" />
						<ComboBox x:Name="ThemeSelector" SelectedIndex="0" Margin="0,12" Width="90" HorizontalAlignment="Center">
							<ComboBoxItem Content="Light" />
							<ComboBoxItem Content="Dark" />
							<!--<ComboBoxItem Content="Custom" />-->
						</ComboBox>

						<!--<StackPanel Margin="0,12">
								<TextBlock Text="Active Cue" />
								<Button Content="Pick" HorizontalAlignment="Right" Padding="2" />
						</StackPanel>-->

					</StackPanel>

				</Grid>
			</TabItem>
            <TabItem Width="80">
                <TabItem.Header>
                    <TextBlock TextWrapping="Wrap" Text="File Options" TextAlignment="Center" />
                </TabItem.Header>
                <StackPanel HorizontalAlignment="Center" Margin="20,10">
                    <TextBlock Style="{StaticResource SectionTitle}" Text="File Options" HorizontalAlignment="Center" />
                    <CheckBox x:Name="KeepBackupFile" Content="Keep a backup file when saving packages." Margin="0,12,0,0" />
                    <CheckBox x:Name="OnlyAllowPackages" Content="Only allow saving as cue packages." Margin="0,8,0,0" />
                </StackPanel>
            </TabItem>
		</TabControl>
		<Border Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{DynamicResource PopupWindowAccent}" />
		<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Left">
			<Button x:Name="Help" Width="75" Height="24" Margin="8" Content="Help" />
		</StackPanel>
		<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
			<Button Content="Cancel" x:Name="Cancel" Width="75" Height="24" Margin="8" />
			<Button Content="Save" x:Name="Save" Width="75" Height="24" Margin="8" />
		</StackPanel>
	</Grid>
</Window>
